package com.yx.feign.api;

import com.yx.feign.impl.GoodsServiceImpl;
import com.yx.feign.impl.UserServiceImpl;
import com.yx.vo.Goods;
import com.yx.vo.GoodsType;
import com.yx.vo.Stock;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Classname GoodsTypeService
 * @Date 2021/07/07 12:54
 * @Author by yx
 * @Description TODO:
 */
@FeignClient(
        name = "shop-goods",
        fallback = GoodsServiceImpl.class //本地降级
)
public interface GoodsService {

    /*
     *以下为goodsTypeController的映射
     * */

    @GetMapping("/goodsType/getGoodsTypeList")
    public List<GoodsType> getGoodsTypeList();

    @PostMapping("/goodsType/addGoodsType")
    public Boolean addGoodsType(@RequestBody GoodsType goodsType);

    @PostMapping("/goodsType/updateGoodsType")
    public Boolean updateGoodsType(@RequestBody GoodsType goodsType);

    @GetMapping("/goodsType/deleteGoodsType/{id}")
    public Boolean deleteGoodsType(@PathVariable("id") Integer id);

    @GetMapping("/goodsType/updateGoodsType/{id}")
    public GoodsType getGoodsTypeById(@PathVariable("id") Integer id);

    @GetMapping("/goodsType/getGoodsTypeListByPid/{pid}")
    List<GoodsType> getGoodsTypeListByPid(@PathVariable("pid") Integer pid);

    /*
     * 以下为goodsController映射
     * */

    @GetMapping("/goods/getGoodsList")
    public List<Goods> getGoodsList();

    @PostMapping("/goods/addGoods")
    public Goods addGoods(@RequestBody Goods goods);

    @PostMapping("/goods/updateGoods")
    public Boolean updateGoods(@RequestBody Goods goods);

    @GetMapping("/goods/deleteGoods/{id}")
    public Boolean deleteGoods(@PathVariable("id") Integer id);

    @GetMapping("/goods/UpdateGoods/{id}")
    Goods getGoodById(@PathVariable("id") Integer id);

    @PostMapping("/goods/addGoodsAndStock")
    Goods addGoodsAndStock(@RequestBody Goods goods);



    /*
     * 以下为stockController映射
     * */

    @PostMapping("/stock/addStock")
    public Boolean addStock(@RequestBody Stock stock);

    @GetMapping("/stock/getStockByGid/{id}")
    Stock getStockByGid(@PathVariable("id") Integer id);
}
